package org.performancetracker.jdbc4;

import java.sql.*;
import java.math.BigDecimal;
import java.io.InputStream;
import java.io.Reader;
import java.util.Calendar;
import java.net.URL;

/**
 * @author: jaronschut
 */

public abstract class AbstractPreparedMonitoringStatement extends AbstractMonitoringStatement implements PreparedStatement {

    /**
     * To override in any subclass.
     *
     * @return
     */
    abstract protected PreparedStatement getRealStatement();

    /**
     * To override in any subclass.
     *
     * @return
     */
    abstract protected Connection getRealConnection();
            
    public ResultSet executeQuery() throws SQLException {
        return getRealStatement().executeQuery();
    }

    public int executeUpdate() throws SQLException {
        return getRealStatement().executeUpdate();
    }

    public void setNull(int parameterIndex, int sqlType) throws SQLException {
        getRealStatement().setNull(parameterIndex, sqlType);
    }

    public void setBoolean(int parameterIndex, boolean x) throws SQLException {
        getRealStatement().setBoolean(parameterIndex, x);
    }

    public void setByte(int parameterIndex, byte x) throws SQLException {
        getRealStatement().setByte(parameterIndex, x);
    }

    public void setShort(int parameterIndex, short x) throws SQLException {
        getRealStatement().setShort(parameterIndex, x);
    }

    public void setInt(int parameterIndex, int x) throws SQLException {
        getRealStatement().setInt(parameterIndex, x);
    }

    public void setLong(int parameterIndex, long x) throws SQLException {
        getRealStatement().setLong(parameterIndex, x);
    }

    public void setFloat(int parameterIndex, float x) throws SQLException {
        getRealStatement().setFloat(parameterIndex, x);
    }

    public void setDouble(int parameterIndex, double x) throws SQLException {
        getRealStatement().setDouble(parameterIndex, x);
    }

    public void setBigDecimal(int parameterIndex, BigDecimal x) throws SQLException {
        getRealStatement().setBigDecimal(parameterIndex, x);
    }

    public void setString(int parameterIndex, String x) throws SQLException {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    public void setBytes(int parameterIndex, byte[] x) throws SQLException {
        getRealStatement().setBytes(parameterIndex, x);
    }

    public void setDate(int parameterIndex, Date x) throws SQLException {
        getRealStatement().setDate(parameterIndex, x);
    }

    public void setTime(int parameterIndex, Time x) throws SQLException {
        getRealStatement().setTime(parameterIndex, x);
    }

    public void setTimestamp(int parameterIndex, Timestamp x) throws SQLException {
        getRealStatement().setTimestamp(parameterIndex, x);
    }

    public void setAsciiStream(int parameterIndex, InputStream x, int length) throws SQLException {
        getRealStatement().setAsciiStream(parameterIndex, x, length);
    }

    public void setUnicodeStream(int parameterIndex, InputStream x, int length) throws SQLException {
        getRealStatement().setUnicodeStream(parameterIndex, x, length);
    }

    public void setBinaryStream(int parameterIndex, InputStream x, int length) throws SQLException {
        getRealStatement().setBinaryStream(parameterIndex, x, length);
    }

    public void clearParameters() throws SQLException {
        getRealStatement().clearParameters();
    }

    public void setObject(int parameterIndex, Object x, int targetSqlType, int scale) throws SQLException {
        getRealStatement().setObject(parameterIndex, x, targetSqlType, scale);
    }

    public void setObject(int parameterIndex, Object x, int targetSqlType) throws SQLException {
        getRealStatement().setObject(parameterIndex, x, targetSqlType);
    }

    public void setObject(int parameterIndex, Object x) throws SQLException {
        getRealStatement().setObject(parameterIndex, x);
    }

    public boolean execute() throws SQLException {
        return getRealStatement().execute();
    }

    public void addBatch() throws SQLException {
        getRealStatement().addBatch();
    }

    public void setCharacterStream(int parameterIndex, Reader reader, int length) throws SQLException {
        getRealStatement().setCharacterStream(parameterIndex, reader, length);
    }

    public void setRef(int i, Ref x) throws SQLException {
        getRealStatement().setRef(i, x);
    }

    public void setBlob(int i, Blob x) throws SQLException {
        getRealStatement().setBlob(i, x);
    }

    public void setClob(int i, Clob x) throws SQLException {
        getRealStatement().setClob(i, x);
    }

    public void setArray(int i, Array x) throws SQLException {
        getRealStatement().setArray(i, x);
    }

    public ResultSetMetaData getMetaData() throws SQLException {
        return getRealStatement().getMetaData();
    }

    public void setDate(int parameterIndex, Date x, Calendar cal) throws SQLException {
        getRealStatement().setDate(parameterIndex, x, cal);
    }

    public void setTime(int parameterIndex, Time x, Calendar cal) throws SQLException {
        getRealStatement().setTime(parameterIndex, x, cal);
    }

    public void setTimestamp(int parameterIndex, Timestamp x, Calendar cal) throws SQLException {
        getRealStatement().setTimestamp(parameterIndex, x, cal);
    }

    public void setNull(int paramIndex, int sqlType, String typeName) throws SQLException {
        getRealStatement().setNull(paramIndex, sqlType, typeName);
    }

    public void setURL(int parameterIndex, URL x) throws SQLException {
        getRealStatement().setURL(parameterIndex, x);
    }

    public ParameterMetaData getParameterMetaData() throws SQLException {
        return getRealStatement().getParameterMetaData();
    }
}
